<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>height</title>
    <style>
        .outer {
            position: relative;
            background-color: pink;
            height: 150px;
            /* line-height: 100px; */
            line-height: 50px;
            width: 100px;
            /* display: flex;
          justify-content: center;
        align-items: center; */
            /* table-cell */
            /* display: table-cell;
            vertical-align: middle;
            text-align: center; */
            /* */
            text-align: center;
        }
        
        .inner {
            /* position: absolute;
          top: 50%;
          left: 50%;
          margin-left: -25px;
          margin-top: -25px;  */
            height: 50px;
            width: 50px;
            /* transform: translateX(-50%) translateY(-50%); //需要写在一起。 */
            /* margin: 0 auto; */
            background-color: skyblue;
            /* 测试 */
            /* margin-top: 10px; */
            /* transform: translate(-50%, -50%); */
            /* display: inline-block; */
            /* 直接用定位 */
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            margin: auto;
        }
    </style>
</head>

<body>
    <div class="outer">
        <div class="inner" href="#">123</div>
    </div>
</body>

</html>